DevNet Resource Kit Article

Formatting Library

The Formatting Library incorporates three ActionScript 2.0 classes: DateFormat, NumberFormat, and Locale. DateFormat and NumberFormat give you precise control over how dates and numbers are formatted into strings for display. Locale and its subclasses affect how DateFormat and NumberFormat display dates and numbers for people who speak different languages or use different formatting conventions.

As well as simplifying the process of formatting dates and numbers into readable forms, the Formatting Library helps you separate logic from presentation, which makes it much easier to localize an application.

The following locales are provided: English (UK), English (USA), French, German, Swedish, Japanese, and Dutch. Read the help that comes with the package for information on how to add your own.

Installing the Formatting Library

You must have the Macromedia Extension Manager installed in order to install these components. If you have not installed the Macromedia Extension Manager, you can install it from the Macromedia website.

Before you install the components, be sure to close the Macromedia Flash MX authoring environment.

Install the components by double-clicking formatting.mxp. This opens the Macromedia Extension Manager, which installs all the files for you automatically.

You may also install the components by first opening the Macromedia Extension Manager, selecting File > Install Extension, and then navigating to formatting.mxp on the DevNet Resource Kit.

Using the Formatting Library

Once you've installed the Formatting Library, the classes will become available to ActionScript 2.0 scripts automatically. All the classes are inside the mx.format package. Use the import keyword at the start of a script to avoid typing the full package name each time.

Read the help section called "Formatting Library," which is installed in the Flash authoring environment, for additional documentation and helpful examples.